#pragma once

#include "SimpleIni.h"
#include "stdafx.h"

#define INI_MAIN_PATH     TEXT("")
#define INI_LANGUAGE_PATH TEXT("\\Lang\\")
#define INI_THEME_PATH    TEXT("\\Themes\\")

class IniReader
{
public:
  static bool Create();
  static void Destroy();

  static const TCHAR* getString(const TCHAR* section, const TCHAR* key, const TCHAR* defVal)
  {
    return IniReader::ini.GetValue(section, key, defVal);
  }

  static bool getBool(const TCHAR* section, const TCHAR* key, const TCHAR* defVal)
  {
	  bool retVal = false;
	  
	  if (wmemcmp(IniReader::ini.GetValue(section, key, defVal), TEXT("1"), 1) == 0)
	  {
		  retVal = true;
	  }

	  if (wmemcmp(IniReader::ini.GetValue(section, key, defVal), TEXT("yes"), 3) == 0)
	  {
		  retVal = true;
	  }

	  return retVal;
  }

  static int getColor(const TCHAR* section, const TCHAR* key, const TCHAR* defVal);

  static int getInt(const TCHAR* section, const TCHAR* key, const TCHAR* defVal)
  {
    return _tcstol(IniReader::ini.GetValue(section, key, defVal), NULL, 10);
  }

public:
  static const TCHAR sectionMain[];
  static const TCHAR sectionLang[];
  static const TCHAR sectionSkin[];

private:
  static CSimpleIniW ini;
  static const TCHAR settings[];
};
